home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_objc.idb / usr / freeware / include / objpak / bag.h.z / bag.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  2.5 KB  |  125 lines

  1.  
  2. /*
  3.  * Portable Object Compiler (c) 1997,98.  All Rights Reserved.
  4.  * $Id: bag.h,v 1.11 1999/06/23 19:22:13 stes Exp $
  5.  */
  6.  
  7. /*
  8.  * This library is free software; you can redistribute it and/or modify it
  9.  * under the terms of the GNU Library General Public License as published 
  10.  * by the Free Software Foundation; either version 2 of the License, or
  11.  * (at your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #ifndef __OBJBAG_H__
  24. #define __OBJBAG_H__
  25.  
  26. #include "cltn.h"
  27.  
  28. typedef struct objbag {
  29.     int        count; /* != size */
  30.     int        capacity;
  31.     id*        ptr;
  32.     int*    cnts;
  33. } *objbag_t;
  34.  
  35. @interface Bag : Cltn
  36. {
  37.     struct objbag    value;
  38. }
  39.  
  40. + new;
  41. + new:(unsigned)n;
  42. + with:(int)nArgs,...;
  43. + with:firstObject with:nextObject;
  44. + add:firstObject;
  45. - copy;
  46. - deepCopy;
  47. - emptyYourself;
  48. - freeContents;
  49. - free;
  50.  
  51. - (unsigned) size;
  52. - (BOOL) isEmpty;
  53. - eachElement;
  54.  
  55. - (BOOL) isEqual:bag;
  56.  
  57. - add:anObject;
  58. - addNTest:anObject;
  59. - filter:anObject;
  60. #if OBJC_BLOCKS
  61. - add:anObject ifDuplicate:aBlock;
  62. #endif /* OBJC_BLOCKS */
  63.  
  64. - replace:anObject;
  65.  
  66. - remove:oldObject;
  67. - remove:oldObject ifAbsent:exceptionBlock;
  68.  
  69. - (BOOL) includesAllOf:aCltn;
  70. - (BOOL) includesAnyOf:aCltn;
  71.  
  72. - addAll:aCltn;
  73. - addContentsOf:aCltn;
  74. - addContentsTo:aCltn;
  75. - removeAll:aCltn;
  76. - removeContentsFrom:aCltn;
  77. - removeContentsOf:aCltn;
  78.  
  79. - intersection:bag;
  80. - union:bag;
  81. - difference:bag;
  82.  
  83. - asSet;
  84. - asOrdCltn;
  85.  
  86. #if OBJC_BLOCKS
  87. - detect:aBlock;
  88. - detect:aBlock ifNone:noneBlock;
  89. - select:testBlock;
  90. - reject:testBlock;
  91. - collect:transformBlock;
  92. - (unsigned) count:aBlock;
  93. #endif /* OBJC_BLOCKS */
  94.  
  95.  
  96. - elementsPerform:(SEL)aSelector;
  97. - elementsPerform:(SEL)aSelector with:anObject;
  98. - elementsPerform:(SEL)aSelector with:anObject with:otherObject;
  99. - elementsPerform:(SEL)aSelector with:anObject with:otherObject with:thirdObj;
  100.  
  101. #if OBJC_BLOCKS
  102. - do:aBlock;
  103. - do:aBlock until:(BOOL*)flag;
  104. #endif /* OBJC_BLOCKS */
  105.  
  106.  
  107. - find:anObject;
  108. - (BOOL) contains:anObject;
  109. - (BOOL) includes:anObject;
  110. - (unsigned) occurrencesOf:anObject;
  111.  
  112. - printOn:(IOD)aFile;
  113.  
  114. #ifdef __PORTABLE_OBJC__
  115. - fileOutOn:aFiler;
  116. - fileInFrom:aFiler;
  117. - awakeFrom:aFiler;
  118. #endif /* __PORTABLE_OBJC__ */
  119.  
  120. @end
  121.  
  122. #endif /* __OBJBAG_H__ */
  123.  
  124.  
  125.